﻿<?php 
	session_start();
	include "connect.php"; 
	
	if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: gv-dangnhap.php");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Giảng Viên chọn lớp học phần xem kết quả</title>
<style type="text/css">

a	{
		color: #006600;
		text-decoration: none;
	}

a:hover { COLOR: #CC0000}

.style2 {
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
}
.style3 {font-size: 14px; font-weight: bold; color: #FFFFFF; }
.style4 {
	color: #000099;
	font-weight: bold;
	font-size:20px;
}
.style5 {	color: #FFFFFF;
	font-weight: bold;
	font-size: 30px;
}
.bg {	border-right-color:#0066FF;
		border-bottom-color:#0066FF;
	}

.bg1 {	border-bottom-color:#0066FF;	}
.bg2 {	border-top-color:#0066FF;}
.bg3 {	border-left-color:#0066FF;}
.bg4 {	border-right-color:#0066FF;}
.mo	{	color:#0000FF;	}

</style>
</head>

<body>
<?php
        $magv=$_SESSION['gv'];

		$sql = mysql_query("Select a.ma_gv,a.ten_gv, a.namsinh_gv, a.gioitinh_gv, c.ten_khoa,d.ten_bm FROM `giang vien` a,  `khoa` c, `bo mon` d where a.ma_gv='$magv' and  a.ma_bm=d.ma_bm and d.ma_khoa=c.ma_khoa") ;		
		while($rows = mysql_fetch_array($sql))
		{
			$msgv=$rows["0"];
			$ten=$rows["1"];
			$namsinh=$rows["2"];
			$gioitinh=$rows["3"];
			$khoa=$rows["4"];
			$bomon=$rows["5"];
			
	    }
	
?>

<table width="900"   border="0" align="center" style="border:1px solid #CCCCCC" height="550">

<!-- đầu trang --> 	
	<tr> <td width="900" height="70" background="image/header.gif">
    	
        <table width="100%" height="100%" border="0"> 
          <tr>
       		
          <td width="10%" rowspan="2"><img src="image/logo.gif" width="100%" height="70" /></td>
            
            <td width="60%" rowspan="2" height="70" align="center" style="font-size:24px"><div align="center">
              <blockquote>
                <p><span class="style5">Website ĐÁNH GIÁ HỌC PHẦN</span></p>
              </blockquote>
          </div></td>
   		  	
          <td width="30%" valign="bottom"> <table>
       		  <tr><td valign="bottom">
           	  <div align="center" class="style3">
              	<a class="style3" href="helpgv.htm" target="_blank">Hướng dẫn</a> | <a class="style3" href="gv-trangchu.php">Trang chủ</a> | <a class="style3" href="logout.php">Thoát</a></div></td></tr>
       	  	  <tr><td valign="bottom">
           	  <div align="center" class="style3">Xin chào, <?php echo $ten; ?> - <?php echo $msgv; ?></div></td></tr> 
   	  	  </table> </td>
        
        </tr> </table>
    
    </td> </tr>

	<tr> <td height="50" width="100%" bordercolor="#FFFFFF"></td> </tr>

<!-- thân trang --> 	
	<tr bordercolor="#FFFFFF"> 
          
          <td width="900" align="center" height="200">
		  <form name="f" method="post" >
				  <table width="500"  border="0"  align="center" style="border:1px solid #0066FF" cellpadding="0" cellspacing="0">
				  
				  
				        <tr bordercolor="#FFFFFF"> 
        	                  <td height="35" colspan="2" align="center" background="image/bg_header.gif">
            	<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">Thống Kê Kết Quả Đánh Giá Học Phần </span>
				             </td>
       	                
						</tr>
						
						<tr height="10"  bordercolor="#FFFFFF" >  
							  <td   align="center" colspan="2">
						
							  </td>
							    
						</tr>
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td  style="font-size:18px; " align="center" width="200">
									Học Kì:
							  </td>
							  <td  align="left" width="200">
									<select name="hk" id="hk" >
									           
									 <?php 
											$sql=mysql_query("select distinct (hocki) from `hocki nienkhoa` where hocki != (select hocki from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)) "); 
											 while($r=mysql_fetch_row($sql))
											 {
												
												$hk=$r[0];
												
									 ?>
											    <option ><?php echo  $hk; ?> </option>
									<?php 
											 }//ngoac while
									?>
									<?php         $sql1=mysql_query("select * from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)");
									              $r1=mysql_fetch_row($sql1);
												  $hk=$r1[1];
									?>
								             <option  selected="selected"><?php  echo $hk;?> </option>
											   
									</select>
							  </td>
							  
						</tr>
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td  style="font-size:18px;" align="center" width="200" >
									Niên Khóa:
							  </td>
							  <td align="left" >
									<select name="nk" id="nk">
									          <?php
											$sql=mysql_query("select distinct(nienkhoa)  from `hocki nienkhoa` where nienkhoa != (select nienkhoa  from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)) "); 
											 while($r=mysql_fetch_row($sql))
											 {
												
												$nk=$r[0];
									 ?>
											    <option ><?php echo  $nk; ?> </option>
									<?php 
											 }//ngoac while
									?>
									<?php         $sql1=mysql_query("select *  from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)");
									              $r1=mysql_fetch_row($sql1);
												  $nk=$r1[2];
									?>
								             <option  selected="selected"><?php  echo $nk;?> </option> 
									</select>
							  </td>
							  
						</tr>
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td   align="center" colspan="2">
									<input type="submit" name="tk" value="Tìm Kiếm" />
							  </td>
							    
						</tr>				
						<tr height="10"  bordercolor="#FFFFFF" >  
							  <td   align="center" colspan="2">
						
							  </td>
							    
						</tr>	
					   
				</table>
		</form>
		
      </td>
	    
	</tr>
	<!-- hang thu 2 trong than trang-->
	<?php if(isset($_POST["tk"]))
	{
	 ?>
	<tr bordercolor="#FFFFFF">
	      <td valign="top">
					<?php
								$hocki=$_POST["hk"]; 
								$nienkhoa=$_POST["nk"]; 
								$nienk="$nienkhoa";
								$str=mysql_query("select * from `hocki nienkhoa` where hocki='$hocki' and nienkhoa = '$nienk' ");
							    $t=mysql_fetch_array($str);
								$hknk=$t[0];
								$str1=mysql_query("select  c.ma_hp,b.ten_hp,c.stt_nhom,c.ma_hknk,sisolop_hp,d.ma_gv  from  `hoc phan` b, `lop hoc phan` c,`giang vien` d where d.ma_gv='$magv' and c.ma_hknk = '$hknk' and b.ma_hp=c.ma_hp and c.ma_gv=d.ma_gv ");
								$count=mysql_num_rows($str1);
								if($count > 0)
								{
								?>
									 
									<table width="800"  border="1"  align="center" bordercolor="#0066FF" cellpadding="0" cellspacing="0">
				  
				  
				        <tr bordercolor="#FFFFFF"> 
        	                  <td height="35" colspan="5" align="center" background="image/bg_header.gif" class="bg2 bg3 bg4">
            	<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">Danh Sách Lớp Học Phần Giảng Dạy  </span>
				<span style="font-size:20px; color:#FFFFFF; font-weight:bold;">( Học Kì: <?php echo $hocki; ?> - Niên Khóa: <?php echo $nienk; ?> )</span>
				             </td>
       	                
						</tr>
						
						
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td  style="font-size:18px; font-weight:bold" align="center" width="120"  class="bg bg3">
									Mã Học Phần
							  </td>
							  <td  style="font-size:18px; font-weight:bold" align="center" width="280"  class="bg">
									Tên Học Phần
							  </td>
							  <td  style="font-size:18px; font-weight:bold" align="center" width="100"  class="bg">
									STT Nhóm
							  </td>
							  <td  style="font-size:18px; font-weight:bold" align="center" width="150" class="bg">
									Sỉ Số Lớp
							  </td>
							  <td  style="font-size:18px; font-weight:bold" align="center" width="150"  class="bg1 bg4">
									Thống Kê
							  </td>
						</tr>
						
				<?php 
				
				while ($kq = mysql_fetch_row($str1) )
				{
				   $ma_hp = $kq[0];
				   $ten_hp = $kq[1];
				   $stt= $kq[2];
				   $hk_nk= $kq[3];
				   $siso=$kq[4];
				   $magv=$kq[5];
				   ?>
				   
				        <tr   bordercolor="#FFFFFF" height="25" >  
							  <td   align="center" width="120"  class="bg bg3" style="font-size:20px;">
									<?php echo $ma_hp; ?>
							  </td>
							  <td   align="center" width="280"  class="bg" style="font-size:20px;">
									<?php echo $ten_hp; ?>
							  </td>
							  <td   align="center" width="100"  class="bg" style="font-size:20px;">
									<?php echo $stt; ?>
							  </td>
							  <td   align="center" width="150" class="bg" style="font-size:20px;">
									<?php echo $siso; ?>
							  </td>
							  <td  style="font-size:20px; font-weight:bold" align="center" width="150"  class="bg1 bg4">
									 <a class="mo" href="<?php echo "gv-thongkekq.php?ma=$ma_hp&&nhom=$stt&&hk=$hk_nk";?>" target="_blank">Xem</a> 
							  </td>
						</tr>
				   
				<?php
				 }
				
				?>		
						<!--
				        <tr height="30"  bordercolor="#FFFFFF" >  
							  <td  style="font-size:18px; font-weight:bold" align="center" width="120"  class="bg bg3" colspan="4">&nbsp;
									
							  </td>
							 
							  <td  style="font-size:20px; font-weight:bold" align="center" width="150"  class="bg1 bg4">
									<a class="mo" href="<?php //echo "gv-thongketatca.php?ma=$magv&&hk=$hk_nk";?>">Xem Tất Cả</a>
							  </td>
						</tr>	        -->
				</table> 
										 
							<?php }//ngoac if
								else
								{
								      echo '<tr> <td height="98" valign="top"  bordercolor="#FFFFFF" align="center" style="color:#000099; font-size:24px; font-weight:bold;"  >Giảng viên không có giảng dạy trong học kì này! </td> </tr>';
								}
								
					?>
	
		  </td> 
	</tr>
	<?php } //ngoac if
	      else
		  {  
	?>
	      <tr bordercolor="#FFFFFF">
		       <td height="180">&nbsp;
			        
			   </td>
		  </tr>
	<?php
	      }//ngoac else 
	?>
	
<!-- cuối trang -->  
	<tr> <td height="50" width="100%" bordercolor="#FFFFFF"></td> </tr>

	<tr> <td height="28" background="image/footer.gif">
    	<table width="100%"> <tr >
    	
    	</tr> </table>
    </td> </tr>
</table>

</body>
</html>


